﻿using PetaPoco;
using QDChat.Util;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace QDChat.Domain
{
    [TableName("chat_session")]
    [PrimaryKey("id")]
    public class Session
    {
        public Session()
        {
            SendTime = Utils.getTimestamp();
        }

        public int Id { get; set; }
        /// <summary>
        /// 发消息人
        /// </summary>
        public int FromUid { get; set; }
        /// <summary>
        /// 收消息人
        /// </summary>
        public int ToUid { get; set; }
        /// <summary>
        /// 最后一条消息
        /// </summary>
        public string LastMsg { get; set; }
        /// <summary>
        /// 发送人未读数
        /// </summary>
        public int FromMsgCount { get; set; }
        /// <summary>
        /// 接收人未读数
        /// </summary>
        public int ToMsgCount { get; set; }
        /// <summary>
        /// 发送时间
        /// </summary>
        public string SendTime { get; set; }
    }

    public class SessionView : Session
    {
        public string NickName { get; set; } = "";
        public string Avatar { get; set; } = "";
        /// <summary>
        /// 我的未读消息数
        /// </summary>
        public int MsgCount { get; set; }
    }
}
